package pojo;

import java.io.Serializable;

/**
 * @author mayanwei
 */
public class Contacts implements Serializable {

    public static final Integer nameLength = 20;
    public static final Integer phoneNumberLength = 11;
    public static final Integer emailLength = 20;
    private  String name;
    private  String phoneNumber;
    private  String email;
    private  char [] resume; //个人简历，可变长，最大长度位128

    public Contacts(String name, String phoneNumber, String email, String resume) {
        this.name = name;
        this.phoneNumber = phoneNumber;
        this.email = email;
        this.resume = resume.toCharArray();
    }

    public Contacts() {
    }

    public String getName() {
        return name;
    }

    /**
     * 长度固定为20位
     * @param name
     * @return
     */
    public Contacts setName(String name) {
        StringBuffer stringBuffer = new StringBuffer(20);
        if(name.length()>20){
            return this;
        }
        stringBuffer.append(name);
        this.name = stringBuffer.toString();
        return this;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    /**
     * 长度固定为11位
     * @param phoneNumber
     * @return
     */
    public Contacts setPhoneNumber(String phoneNumber) {
        StringBuffer stringBuffer = new StringBuffer(11);
        if(phoneNumber.length()>11){
            return this;
        }
        stringBuffer.append(phoneNumber);
        this.phoneNumber = stringBuffer.toString();
        return  this;
    }

    public String getEmail() {
        return email;
    }

    /**
     * 长度固定为20位
     * @param email
     * @return
     */
    public Contacts setEmail(String email) {
        StringBuffer stringBuffer = new StringBuffer(20);
        if(email.length()>20){
            return this;
        }
        stringBuffer.append(email);
        this.email = stringBuffer.toString();
        return this;
    }

    public String getResume() {
        return new String(resume);
    }

    public Contacts setResume(String resume) {
        this.resume = resume.toCharArray();
        return this;
    }

    @Override
    public String toString() {
        return "name:" + name +" phoneNumber:" + phoneNumber + " email:" +email + " resume:" +new String(resume);
    }
}
